from django.apps import AppConfig


class AppConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'App'

    def ready(self):
        # 启动定时任务的代码
        import os
        if os.environ.get('RUN_MAIN') == 'true':
            from App.tasks import start_scheduler
            start_scheduler()
